/***************************************
	文件：GoapGoalMap.cs
	作者：林文豪
	日期：2021-05-16
	功能：1、
****************************************/

using System;
using System.Collections.Generic;
using MyGame.Global;

namespace MyGame.AI.GOAP {
	public class GoapGoalMap : IEquatable<GoapGoalMap> {
		private IGoal         _Goal;
		private List<IAction> _Actions;

		public GoapGoalMap(IGoal goal,List<IAction> actions) {
			_Goal    = goal;
			_Actions = actions;
		}

		public bool Equals(GoapGoalMap other) {
			if (other == null) {
				return false;
			}

			if (string.Equals(_Goal.GetNodeName(),other._Goal.GetNodeName())) {
				return false;
			}

			// TODO : 将Actions进行封装，实现Equalable接口
			foreach (IAction action in _Actions) {
				if (other._Actions.Contains(action) == false) {
					return false;
				}
			}
			return true;
		}
	}
}
